package com.mangowang.module.main.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mangowang.lib.common.proto.MemberOuterClass;
import com.mangowang.lib.common.proto.Merchant;
import com.mangowang.lib.common.util.ValidateUtils;
import com.mangowang.module.main.R;

import java.util.List;

public class ShopNewNextAdapter extends BaseQuickAdapter<Merchant.merchant_info, BaseViewHolder> implements LoadMoreModule {
    public ShopNewNextAdapter(Context context, List<Merchant.merchant_info> dataList) {
        super(R.layout.item_shop_new_next, dataList);
    }

    @Override
    protected void convert(BaseViewHolder helper, Merchant.merchant_info item) {

        if (TextUtils.isEmpty(item.getMerchantRemarks())) {
            helper.setText(R.id.tv_zhu, ValidateUtils.isValidate(item.getMerchantMerchantName()) ? item.getMerchantMerchantName() : "未设置备注");
        } else {
            helper.setText(R.id.tv_zhu, item.getMerchantRemarks());
        }
        helper.setText(R.id.tv_name, "品牌名称 :" + item.getGoodsInfo())
                .setText(R.id.tv_sn, "SN :" + item.getSnCode())
                .setText(R.id.tv_yuan_bi, item.getTrading() + "元/" + item.getNum() + "笔");
        if (item.getActivation().equals("1"))
            helper.setBackgroundResource(R.id.iv_logo, R.mipmap.shop_ac);
        if (item.getActivation().equals("0"))
            helper.setBackgroundResource(R.id.iv_logo, R.mipmap.shop_un);

    }

}
